<?php
/**
 *  采集入口文件
 */

define('CURSITE','WAP');
define('SUB_SITE_ROOT', dirname(__FILE__));
include(SUB_SITE_ROOT.'/../config.inc.php');
///include(SUB_SITE_ROOT.'/../includes/common.inc.php');

require_once (SITE_ROOT.'/includes/core.php');
$is_wap = check_wap();//是否wap访问，1是0不是
//isset($_GET['action']) ? $action = $_GET['action'] : $action = 'index';
isset($_GET['__path']) ? $__path = $_GET['__path'] : $__path = '';

/*if(!$__path){
	echo '转';
	header("Location: login/");
	exit();
}else{

}*/
//PRINT_R( $_SERVER['SCRIPT_URL']);
//$action ='login';

if($__path){
	//ECHO $__path;
	$tmp = explode('/', $__path);
	$action =$tmp[0];
	$operate =$tmp[1];
	$id =$tmp[2];
	
	$_var['action'] =$action;
	$_var['operate'] =$operate;
	$_var['id'] =$id;
	
	
	//exit();
}else{
	$action='index';
}

if(!$_SESSION['members']['username'] &&  $action!='login' &&  $action!='logout') {
	header("Location: /login/");
	exit();
}
/*
Dear Customer an unexpected error had occurred, please try again later or you can contact our customer service with 
ErrorID:
D05-014-106
*/
	
if($_SYSTEM['system_um']){
	exit('系统维护中...');
}
if(!$action)$action='index';
$action_file = 'model/'.$action.'.php';

if(is_file($action_file)){
	include($action_file);
}else{
		header('Status: 404 Not Found');
		header('HTTP/1.0 404 Not Found');
		echo 'HTTP/1.0 404 Not Found';
		exit();
}
empty($tpl) ? $tpl = $action : 0;   

if($tpl != '__NOUSETPL__'){
	//header("Content-Type:text/html;charset=utf-8");
	core::view ( 'view/'.$tpl.'.php', $view_array);
}  
?>